const isIterable = obj => obj && typeof obj[Symbol.iterator] === 'function';

const scrollToElem = (elem, offset = 0) => {
  console.log(elem, elem.offsetTop, offset);
  let top = elem.offsetTop;
  elem = elem.offsetParent;
  while (elem) {
    top += elem.offsetTop;
    elem = elem.offsetParent;
  }
  window.scrollTo({
    top: top - offset,
    behavior: "smooth" // 平滑滚动
  })
}

export {
  isIterable,
  scrollToElem,
}